<div class="build-pipeline">
  <div class="build-summary">
    <div ng-if="buildConfigNameOnExpanded" class="build-name">
      <a ng-href="{{build | configURLForResource}}">{{buildConfigName}}</a>
    </div>
    <div class="build-phase">
      <span class="status-icon" ng-class="build.status.phase">
        <span ng-switch="build.status.phase" class="hide-ng-leave">
          <span ng-switch-when="Complete" aria-hidden="true">
            <i class="fa fa-check-circle fa-fw"></i>
          </span>
          <span ng-switch-when="Failed" aria-hidden="true">
            <i class="fa fa-times-circle fa-fw"></i>
          </span>
          <span ng-switch-default>
            <status-icon status="build.status.phase"></status-icon>
          </span>
        </span>
      </span>
      <a ng-href="{{build | navigateResourceURL}}">Build #{{build | annotation : 'buildNumber'}}</a>
    </div>
    <span am-time-ago="build.metadata.creationTimestamp" class="build-timestamp"></span>
    <div ng-include="'views/directives/_build-pipeline-links.html'" class="build-links"></div>
  </div>
  <div class="pipeline-container">
    <div class="pipeline" ng-if="!jenkinsStatus.stages.length">
      <div class="pipeline-stage no-stages">
        <div class="pipeline-stage-name">No stages have started.</div>
      </div>
    </div>
    <div class="pipeline">
      <div class="pipeline-stage" ng-repeat="stage in jenkinsStatus.stages track by stage.id">
        <div class="pipeline-stage-column">
          <div title="{{stage.name}}" class="pipeline-stage-name" ng-class="build.status.phase">
            {{stage.name}}
          </div>
          <pipeline-status ng-if="stage.status" status="stage.status"></pipeline-status>
          <div class="pipeline-actions" ng-if="stage | pipelineStagePendingInput">
            <a ng-href="{{build | jenkinsInputURL}}" target="_blank">Input Required</a>
          </div>
          <div class="pipeline-time" ng-class="stage.status" ng-if="!stage.durationMillis && !(stage | pipelineStagePendingInput)">not started</div>
          <div class="pipeline-time" ng-class="stage.status" ng-if="stage.startTimeMillis && !(stage | pipelineStagePendingInput) && !(stage | pipelineStageComplete)"><time-only-duration-until-now timestamp="stage.startTimeMillis"></time-only-duration-until-now></div>
          <div class="pipeline-time" ng-class="stage.status" ng-if="stage.durationMillis && (stage | pipelineStageComplete)">{{stage.durationMillis | timeOnlyDuration}}</div>
        </div>
      </div>
    </div>
  </div>
</div>
